package com.example.shopping.fpage;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import java.util.List;
public class LunboAdapter extends PagerAdapter {
    List<ImageView>list;
    public LunboAdapter(List<ImageView> list) { this.list = list; }
    @Override
    public int getCount() { return list.size(); }
    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return view == object;
    }
    @NonNull
    @Override
    public Object instantiateItem(@NonNull ViewGroup container, int position) {
        ImageView imageView = list.get(position);
        container.addView(imageView);
        return imageView;
    }
    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        ImageView imageView = list.get(position);
        container.removeView(imageView);
    }
}

